<?php

if (validation_errors()) :
?>
<section class="content-header">
<div class='alert alert-block alert-error fade in'>
    <a class='close' data-dismiss='alert'>&times;</a>
    <h4 class='alert-heading'>
        <?php echo lang('area_errors_message'); ?>
    </h4>
    <?php echo validation_errors(); ?>
</div>
</section>
<?php
endif;

$id = isset($area->area_id) ? $area->area_id : '';

?>

<!-- <section class="content-header">
      <h1>
        General Form Elements
        <small>Preview</small>
      </h1>
      <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
        <li><a href="#">Forms</a></li>
        <li class="active">General Elements</li>
      </ol>
    </section> -->

<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-xs-12">
        <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">新增<?php echo lang('area_area_title'); ?></h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <?php echo form_open($this->uri->uri_string(), 'class="form-horizontal"'); ?>
              <div class="box-body">
                <div class="form-group">
                  <?php echo form_label('上级省市', 'p_id', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-5">
                        <select class="form-control select2" style="width: 100%;" name="province_id" id="province_id">
                          <option selected="selected" value="0">可选择省份</option>
                          <?php foreach ($provinces as $province) : ?>
                          <option value="<?php echo $province->area_id; ?>"><?php echo $province->area_name; ?></option>
                        <?php endforeach; ?>
                        </select>
                    </div>

                    <div class="col-sm-5">
                        <select class="form-control select2" style="width: 100%;" name="city_id" id="city_id">
                          <option selected="selected" value="0">可选择城市</option>
                        </select>
                    </div>

                </div>
                <div class="form-group">
                <?php echo form_label('类型', 'area_type', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-10">
                        <select class="form-control select2" style="width: 100%;" name="area_type" id="area_type" disabled="disabled">
                          <option selected="selected" value="1">省份</option>
                          <option value="2">城市</option>
                          <option value="3">区县</option>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                <?php echo form_label('省份\城市\区县名' . lang('bf_form_label_required'), 'area_name', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-10">
                    <input id='area_name' type='text' name='area_name' maxlength='20' class="form-control" value="<?php echo set_value('area_name', isset($area->area_name) ? $area->area_name : ''); ?>" />
                    </div>
                </div>

              <div class="form-group">
                <?php echo form_label('所属板块' , 'plates', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-10">
                          <select class="form-control select2" style="width: 100%;" name="plates" id="plates" >
                                <option selected="selected" value="0">可选择板块</option>
                                <?php foreach ( area_block_name() as $key => $value) : ?>
                                    <option value="<?php e($key);?>"><?php e($value);?></option>
                                <?php endforeach;?>
                        </select>
                    </div>
                </div>

                <div class="form-group">
                <?php echo form_label('开通城市', 'active', array('class'=>'col-sm-2 control-label')); ?>
                    <div class="col-sm-10">
                        <input type="checkbox" class="minimal" name="active" id="active" />
                    </div>
                </div>
                
              </div>
              <!-- /.box-body -->

              <div class="box-footer">
                <button type="submit" name='save' class="btn btn-primary">Submit</button>
                <?php echo anchor(SITE_AREA . '/content/area', lang('area_cancel'), 'class="btn btn-default pull-right"'); ?>
              </div>
            <?php echo form_close(); ?>
          </div>

          </div>
      </div>
</section>
